// 检查集合是否存在，不存在才创建
if (!db.getCollectionNames().includes("anchor_audience_status_operation_log")) {
    db.createCollection("anchor_audience_status_operation_log");
}
db.getCollection("anchor_audience_status_operation_log").createIndex({
    anchor_id: Int32("1")
}, {
    name: "anchor_id_1"
});
db.getCollection("anchor_audience_status_operation_log").createIndex({
    audience_id: Int32("1")
}, {
    name: "audience_id_1"
});
db.getCollection("anchor_audience_status_operation_log").createIndex({
    operation_user_id: Int32("1")
}, {
    name: "operation_user_id_1"
});
db.getCollection("anchor_audience_status_operation_log").createIndex({
    operation_type: Int32("1")
}, {
    name: "operation_type_1"
});
db.getCollection("anchor_audience_status_operation_log").createIndex({
    create_time: Int32("1")
}, {
    name: "create_time_1"
});

// ----------------------------
// Collection structure for domain_ban_detection_log
// ----------------------------
if (!db.getCollectionNames().includes("domain_ban_detection_log")) {
    db.createCollection("domain_ban_detection_log");
}

// ----------------------------
// Collection structure for im_group_chat
// ----------------------------
if (!db.getCollectionNames().includes("im_group_chat")) {
    db.createCollection("im_group_chat");
}
db.getCollection("im_group_chat").createIndex({
    group_id: Int32("-1")
}, {
    name: "group_id_NumberInt(\"-1\")"
});
db.getCollection("im_group_chat").createIndex({
    "content_datas.data.type": Int32("-1")
}, {
    name: "content_datas_data_type_desc"
});

db.getCollection("im_group_chat").createIndex({
    group_id: Int32("1"),
    status: Int32("1"),
    "content_datas.data.type": Int32("1"),
    create_time: Int32("-1")
}, {
    name: "group_id_1_status_1_content_datas.data.type_1_create_time_-1"
});

// ----------------------------
// Collection structure for live_ad_content_log
// ----------------------------
if (!db.getCollectionNames().includes("live_ad_content_log")) {
    db.createCollection("live_ad_content_log");
}
db.getCollection("live_ad_content_log").createIndex({
    member_id: Int32("-1")
}, {
    name: "member_id_NumberInt(\"-1\")"
});
db.getCollection("live_ad_content_log").createIndex({
    live_id: Int32("-1")
}, {
    name: "live_id_NumberInt(\"-1\")"
});

// ----------------------------
// Collection structure for live_applet_placard_log
// ----------------------------
if (!db.getCollectionNames().includes("live_applet_placard_log")) {
    db.createCollection("live_applet_placard_log");
}
db.getCollection("live_applet_placard_log").createIndex({
    live_id: Int32("-1")
}, {
    name: "live_id_-1"
});

// ----------------------------
// Collection structure for live_distribute_urls
// ----------------------------
if (!db.getCollectionNames().includes("live_distribute_urls")) {
    db.createCollection("live_distribute_urls");
}
db.getCollection("live_distribute_urls").createIndex({
    live_id: Int32("-1")
}, {
    name: "index0"
});

// ----------------------------
// Collection structure for live_playback_log
// ----------------------------
if (!db.getCollectionNames().includes("live_playback_log")) {
    db.createCollection("live_playback_log");
}
db.getCollection("live_playback_log").createIndex({
    live_id: Int32("1")
}, {
    name: "live_id_1"
});
db.getCollection("live_playback_log").createIndex({
    member_id: Int32("1")
}, {
    name: "member_id_1"
});
db.getCollection("live_playback_log").createIndex({
    streamKey: "hashed"
}, {
    name: "streamKey_1"
});

// ----------------------------
// Collection structure for live_popularity
// ----------------------------
if (!db.getCollectionNames().includes("live_popularity")) {
    db.createCollection("live_popularity");
}
db.getCollection("live_popularity").createIndex({
    member_id: Int32("1")
}, {
    name: "member_id"
});
db.getCollection("live_popularity").createIndex({
    live_id: Int32("1")
}, {
    name: "live_id"
});

// ----------------------------
// Collection structure for live_record_video_log
// ----------------------------
if (!db.getCollectionNames().includes("live_record_video_log")) {
    db.createCollection("live_record_video_log");
}

// ----------------------------
// Collection structure for live_screen_review_log
// ----------------------------
if (!db.getCollectionNames().includes("live_screen_review_log")) {
    db.createCollection("live_screen_review_log");
}

// ----------------------------
// Collection structure for live_special_log
// ----------------------------
if (!db.getCollectionNames().includes("live_special_log")) {
    db.createCollection("live_special_log");
}

// ----------------------------
// Collection structure for live_title_sensitive_words
// ----------------------------
if (!db.getCollectionNames().includes("live_title_sensitive_words")) {
    db.createCollection("live_title_sensitive_words");
}

// ----------------------------
// Collection structure for live_user_random_robot_language_log
// ----------------------------
if (!db.getCollectionNames().includes("live_user_random_robot_language_log")) {
    db.createCollection("live_user_random_robot_language_log");
}

// ----------------------------
// Collection structure for member_auto_distribution_urls
// ----------------------------
if (!db.getCollectionNames().includes("member_auto_distribution_urls")) {
    db.createCollection("member_auto_distribution_urls");
}
db.getCollection("member_auto_distribution_urls").createIndex({
    member_id: Int32("1")
}, {
    name: "member_id"
});

// ----------------------------
// Collection structure for member_behavior_report
// ----------------------------
if (!db.getCollectionNames().includes("member_behavior_report")) {
    db.createCollection("member_behavior_report");
}

// ----------------------------
// Collection structure for member_distribute_urls
// ----------------------------
if (!db.getCollectionNames().includes("member_distribute_urls")) {
    db.createCollection("member_distribute_urls");
}
db.getCollection("member_distribute_urls").createIndex({
    member_id: Int32("1")
}, {
    name: "member_id"
});
db.getCollection("member_distribute_urls").createIndex({
    live_id: Int32("1")
}, {
    name: "live_id"
});

// ----------------------------
// Collection structure for member_distribution_posters
// ----------------------------
if (!db.getCollectionNames().includes("member_distribution_posters")) {
    db.createCollection("member_distribution_posters");
}
db.getCollection("member_distribution_posters").createIndex({
    member_id: Int32("1")
}, {
    name: "member_id"
});
db.getCollection("member_distribution_posters").createIndex({
    status: Int32("1")
}, {
    name: "status"
});

// ----------------------------
// Collection structure for member_error_report
// ----------------------------
if (!db.getCollectionNames().includes("member_error_report")) {
    db.createCollection("member_error_report");
}

// ----------------------------
// Collection structure for member_fix_root
// ----------------------------
if (!db.getCollectionNames().includes("member_fix_root")) {
    db.createCollection("member_fix_root");
}
db.getCollection("member_fix_root").createIndex({
    member_id: Int32("-1")
}, {
    name: "member_id"
});
db.getCollection("member_fix_root").createIndex({
    live_id: Int32("-1")
}, {
    name: "live_id"
});
db.getCollection("member_fix_root").createIndex({
    is_switch: Int32("1")
}, {
    name: "is_switch"
});
db.getCollection("member_fix_root").createIndex({
    status: Int32("1")
}, {
    name: "status"
});

// ----------------------------
// Collection structure for member_fix_root_log
// ----------------------------
if (!db.getCollectionNames().includes("member_fix_root_log")) {
    db.createCollection("member_fix_root_log");
}
db.getCollection("member_fix_root_log").createIndex({
    anchor_id: Int32("1")
}, {
    name: "anchor_id"
});
db.getCollection("member_fix_root_log").createIndex({
    member_id: Int32("1")
}, {
    name: "member_id"
});
db.getCollection("member_fix_root_log").createIndex({
    robot_id: Int32("1")
}, {
    name: "robot_id"
});

// ----------------------------
// Collection structure for member_font_size_log
// ----------------------------
if (!db.getCollectionNames().includes("member_font_size_log")) {
    db.createCollection("member_font_size_log");
}
db.getCollection("member_font_size_log").createIndex({
    member_id: Int32("1")
}, {
    name: "member_id"
});
db.getCollection("member_font_size_log").createIndex({
    live_id: Int32("1")
}, {
    name: "live_id"
});

// ----------------------------
// Collection structure for member_invitation
// ----------------------------
if (!db.getCollectionNames().includes("member_invitation")) {
    db.createCollection("member_invitation");
}
db.getCollection("member_invitation").createIndex({
    live_id: Int32("-1")
}, {
    name: "live_id_NumberInt(\"-1\")"
});
db.getCollection("member_invitation").createIndex({
    member_id: Int32("-1")
}, {
    name: "member_id_NumberInt(\"-1\")"
});

// ----------------------------
// Collection structure for member_invitation_relations
// ----------------------------
if (!db.getCollectionNames().includes("member_invitation_relations")) {
    db.createCollection("member_invitation_relations");
}

// ----------------------------
// Collection structure for member_ios_pay
// ----------------------------
if (!db.getCollectionNames().includes("member_ios_pay")) {
    db.createCollection("member_ios_pay");
}

// ----------------------------
// Collection structure for member_live_http_dns_log
// ----------------------------
if (!db.getCollectionNames().includes("member_live_http_dns_log")) {
    db.createCollection("member_live_http_dns_log");
}

// ----------------------------
// Collection structure for member_live_random_log
// ----------------------------
if (!db.getCollectionNames().includes("member_live_random_log")) {
    db.createCollection("member_live_random_log");
}
db.getCollection("member_live_random_log").createIndex({
    live_member_id: Int32("1")
}, {
    name: "live_member_id"
});
db.getCollection("member_live_random_log").createIndex({
    member_id: Int32("1")
}, {
    name: "member_id"
});
db.getCollection("member_live_random_log").createIndex({
    status: Int32("1")
}, {
    name: "status"
});

// ----------------------------
// Collection structure for member_live_summary
// ----------------------------
if (!db.getCollectionNames().includes("member_live_summary")) {
    db.createCollection("member_live_summary");
}
db.getCollection("member_live_summary").createIndex({
    user_id: Int32("1")
}, {
    name: "user_id"
});

// ----------------------------
// Collection structure for member_remove_sys_tags_log
// ----------------------------
if (!db.getCollectionNames().includes("member_remove_sys_tags_log")) {
    db.createCollection("member_remove_sys_tags_log");
}
db.getCollection("member_remove_sys_tags_log").createIndex({
    tag_id: Int32("-1")
}, {
    name: "tag_id_NumberInt(\"-1\")"
});
db.getCollection("member_remove_sys_tags_log").createIndex({
    member_id: Int32("-1")
}, {
    name: "member_id_NumberInt(\"-1\")"
});
db.getCollection("member_remove_sys_tags_log").createIndex({
    status: Int32("-1")
}, {
    name: "status_NumberInt(\"-1\")"
});

// ----------------------------
// Collection structure for member_tags_log
// ----------------------------
if (!db.getCollectionNames().includes("member_tags_log")) {
    db.createCollection("member_tags_log");
}
db.getCollection("member_tags_log").createIndex({
    live_id: Int32("-1")
}, {
    name: "live_id"
});
db.getCollection("member_tags_log").createIndex({
    member_id: Int32("-1")
}, {
    name: "member_id"
});
db.getCollection("member_tags_log").createIndex({
    user_id: Int32("-1")
}, {
    name: "user_id_NumberInt(\"-1\")"
});
db.getCollection("member_tags_log").createIndex({
    status: Int32("1")
}, {
    name: "status_NumberInt(\"1\")"
});

// ----------------------------
// Collection structure for member_vip_order_recovery
// ----------------------------
if (!db.getCollectionNames().includes("member_vip_order_recovery")) {
    db.createCollection("member_vip_order_recovery");
}

// ----------------------------
// Collection structure for oceanengine_db
// ----------------------------
if (!db.getCollectionNames().includes("oceanengine_db")) {
    db.createCollection("oceanengine_db");
}

// ----------------------------
// Collection structure for operator_log
// ----------------------------
if (!db.getCollectionNames().includes("operator_log")) {
    db.createCollection("operator_log");
}
db.getCollection("operator_log").createIndex({
    member_id: Int32("-1")
}, {
    name: "member_id"
});
db.getCollection("operator_log").createIndex({
    create_time: Int32("-1")
}, {
    name: "create_time"
});

// ----------------------------
// Collection structure for promote_data
// ----------------------------
if (!db.getCollectionNames().includes("promote_data")) {
    db.createCollection("promote_data");
}
db.getCollection("promote_data").createIndex({
    create_time: Int32("1")
}, {
    name: "create_time_1"
});
db.getCollection("promote_data").createIndex({
    is_ativate: Int32("1")
}, {
    name: "is_ativate_1"
});
db.getCollection("promote_data").createIndex({
    first_pay: Int32("1")
}, {
    name: "first_pay_1"
});
db.getCollection("promote_data").createIndex({
    member_id: Int32("1")
}, {
    name: "member_id_1"
});
db.getCollection("promote_data").createIndex({
    idfa: Int32("1")
}, {
    name: "idfa_1"
});
db.getCollection("promote_data").createIndex({
    ipv4: Int32("1")
}, {
    name: "ipv4_1"
});

// ----------------------------
// Collection structure for sensitive_words
// ----------------------------
if (!db.getCollectionNames().includes("sensitive_words")) {
    db.createCollection("sensitive_words");
}
db.getCollection("sensitive_words").createIndex({
    status: Int32("1")
}, {
    name: "status"
});

// ----------------------------
// Collection structure for statistics_live_chat_mic_avg_people_log
// ----------------------------
if (!db.getCollectionNames().includes("statistics_live_chat_mic_avg_people_log")) {
    db.createCollection("statistics_live_chat_mic_avg_people_log");
}

// ----------------------------
// Collection structure for wx_pay_notice
// ----------------------------
if (!db.getCollectionNames().includes("wx_pay_notice")) {
    db.createCollection("wx_pay_notice");
}
